.留言内容较长时,应打点提示
.留言条目总数
接口 | 说明 |
---|---|
/message | 全部拉取 |
.提交时,使用样式如动画形式高亮输入框提示用户
.提交时,可以选择保存在本地或自建服务器
.轮播 - 可以采用第三方库 swiper
.定制字体 @font-face
.其它设计
let msgs = ref([]) let msg = ref('') let isRem = ref(false) let isFocus = ref(false) let imgInd = ref(0) let imgs = []
<div class="cont"> <input :class="['ipt', { 'border-color': isFocus }]" type="text" v-model.trim="msg" placeholder="message here. press ALT+Enter to submit" @keyup.alt.enter="submitMsg" @focus="getFocus" @blur="loseFocus"> </div>
const submitMsg = () => { if (msg.value) { msgs.value.unshift(msg.value) msg.value = '' isFocus.value = false } } const getFocus = () => { isFocus.value = true } const loseFocus = () => { isFocus.value = false }
.ipt.border-color { border-color: #942d00; }
<div class="subcount"> <div>total {{ msgs.length }} messages</div> <button class="del-btn" @click="delAllMsg"> <span v-if="msgs.length">delete</span> <span v-else class="iconfont icon-ban"></span> </button> </div>
<header class="header" :style="{ 'backgroundImage': 'url(' + imgs[imgInd] + ')' }"> <div class="dot-box"> <div :class="['dot', { 'active': ind == imgInd }]" v-for="(item, ind) in imgs.length " :key="item">{{ ind }} </div> </div> </header>
onMounted(() => { ind = setInterval(() => { updateImg() }, 3000); axios.get('https://glpla.github.io/utils/data/todo.json') .then(res => { msgs.value = res.data.cont }) })